const Schedule = require('node-schedule');
const UserDao = require('../dao/userDao');
exports.updateAddNum = function () {
    // let rule = new Schedule.RecurrenceRule();
    // rule.dayOfWeek = [0, new Schedule.Range(1, 6)];
    // rule.hour = 0;
    // rule.minute = 0;
    console.log("start scheduleJob");
    Schedule.scheduleJob('0 0 0 * * *', function () {
        UserDao.updateAllUser(masterPool, {FreeAddNum: 1})
            .then(function (result) {
                console.log('everyDayUpdate success', result);
            }, function (err) {
                console.log('everyDayUpdate fail', err);
            });
    });
};
